package com.zziq.mianshi.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zziq.mianshi.model.dto.questionBankQuestion.QuestionBankQuestionQueryRequest;
import com.zziq.mianshi.model.entity.QuestionBankQuestion;
import com.zziq.mianshi.model.entity.User;
import com.zziq.mianshi.model.vo.QuestionBankQuestionVO;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 题库题目关联服务
 */
public interface QuestionBankQuestionService extends IService<QuestionBankQuestion> {

    /**
     * 校验数据
     *
     * @param questionBankQuestion
     * @param add 对创建的数据进行校验
     */
    void validQuestionBankQuestion(QuestionBankQuestion questionBankQuestion, boolean add);

    /**
     * 获取查询条件
     *
     * @param questionBankQuestionQueryRequest
     * @return
     */
    QueryWrapper<QuestionBankQuestion> getQueryWrapper(QuestionBankQuestionQueryRequest questionBankQuestionQueryRequest);
    
    /**
     * 获取题库题目关联封装
     *
     * @param questionBankQuestion
     * @param request
     * @return
     */
    QuestionBankQuestionVO getQuestionBankQuestionVO(QuestionBankQuestion questionBankQuestion, HttpServletRequest request);

    /**
     * 分页获取题库题目关联封装
     *
     * @param questionBankQuestionPage
     * @param request
     * @return
     */
    Page<QuestionBankQuestionVO> getQuestionBankQuestionVOPage(Page<QuestionBankQuestion> questionBankQuestionPage, HttpServletRequest request);


    /** @Title: batchAddQuestionBankQuestion
     * @Author: Mr·zziq
     * @Date: 2024-12-08 14:02:56
     * @Params: [questionIdList, questionBankId, loginUserId]
     * @Return: void
     *
     * @Description: 批量添加 题库题目关联
     */
    void batchAddQuestionBankQuestion(List<Long> questionIdList, Long questionBankId, User loginUser);

    /** @Title: batchAddQuestionBankQuestionInner
     * @Author: Mr·zziq
     * @Date: 2024-12-08 17:57:19
     * @Params: [validQuestionIdList, questionBankId, loginUser] 
     * @Return: void 
     * 
     * @Description: 批量添加 题库题目关联（操作数据库事务方法）
     */
    @Transactional(rollbackFor = Exception.class)
    void batchAddQuestionBankQuestionInner(List<QuestionBankQuestion> questionBankQuestionList);

    /** @Title: batchRemoveQuestionBankQuestion
     * @Author: Mr·zziq
     * @Date: 2024-12-08 14:48:47
     * @Params: [questionIdList, questionBankId]
     * @Return: void
     *
     * @Description: 批量删除 题库题目关联
     */
    void batchRemoveQuestionBankQuestion(List<Long> questionIdList, Long questionBankId);
    
    
}
